<!DOCTYPE html>
<html style="background-color: #f8f8f8;">
	<head>
		<meta charset="utf-8" />
		<meta name="viewport"
			content="width=device-width, initial-scale=0.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
		<!-- <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" /> -->
		<link rel="stylesheet" type="text/css" href="{{asset('user/css/baoxiu.css')}}"/>
		<link rel="stylesheet" type="text/css" href="{{asset('user/css/reset.css')}}"/>
		<link rel="stylesheet" type="text/css" href="{{asset('user/css/from.css')}}" />
		<link rel="stylesheet" type="text/css" href="{{asset('user/css/paidan.css')}}" />
		<script src="{{asset('user/js/jquery-3.2.1.min.js')}}"></script>
		<script src="{{asset('user/js/lib-flex.js')}}" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<!-- 头部标题 start -->
		<header class="header">
			<a href="{{url()->previous()}}">
				<img src="{{asset('user/img/fanhui.png')}}" />
			</a>
			<h3>工单详情</h3>
		</header>
		<!-- 头部标题 end -->
		<!-- 切换start -->
		<div class="tab-nav">
			<!-- <div class="new active">
				<h5>当前报修</h5>
				<div class="line" style="display: block;"></div>
			</div>
			<div class="old">
				<h5>历史报修</h5>
				<div class="line"></div>
			</div> -->
		</div>
		<!-- 切换end -->
		
		<!-- 报修内容 start -->
		<div class="content">
			<div class="title">
				<h3>{{$data->car_num}}</h3>
				<div class="jiedan">{{array_get($levelArr,$data->level)}}</div>
			</div>
			<div class="content-line"></div>
			<div class="content-item">
				<div class="item-title">
					客户
				</div>
				<div class="item-body">
					{{$data->customer_name}}
				</div>
			</div>
			<div class="content-item">
				<div class="item-title">
					送修时间 
				</div>
				<div class="item-body">
					{{$data->in_date}}
				</div>
			</div>
			<div class="content-item">
				<div class="item-title">
					送修人 
				</div>
				<div class="item-body">
					{{$data->contacter}} <a href="tel:{{$data->mobile}}">{{$data->mobile}}</a>
				</div>
			</div>
			
			
			<div class="content-item">
				<div class="item-title">
					车型
				</div>
				<div class="item-body">
					{{$data->car_model}}
				</div>
			</div>
			<div class="content-item">
				<div class="item-title">
					故障信息
				</div>
				<div class="item-body">
					{{$data->contents}}
				</div>
			</div>

			<div class="content-item">
				<div class="item-title">
					维修负责人
				</div>
				<div class="item-body">
					{{object_get($data,'worker.truename')}} &nbsp;电话：<a href="tel:{{object_get($data,'worker.phone')}}">{{object_get($data,'worker.phone')}}</a>
				</div>
			</div>
			
			

			<div class="content-item">
				<div class="item-title">
					状态
				</div>
				<div class="item-body">
					{{$data->status}}
				</div>
			</div>


			 @if($worker)
			<div class="line-2"></div>
			<div class="team">
				<div class="team-btn team-btn-2">
					<span id="btnComplete" style="cursor:pointer">反馈信息</span>
				</div>
			</div>
			@endif


			  

			

			@if($data->status>1)
			<div class="line-2"></div>
			<div class="team">
				技师：{{$data->worker->truename}}
			</div>
			@endif


			
			@if(object_get($worker,'role_code')==1)
			<div class="team">
				<div class="team-btn team-btn-3" id="paidan">
					{{$data->status==2?'改派':'派单'}}
				</div>
			</div>
			@endif
		</div>
		<!-- 报修内容 end -->

		
		
		<!-- 遮罩层start -->
		<div class="mask"></div>
		<!-- 遮罩层end -->
		
		<!-- 弹出框 start -->
		<div class="popup_bg_1">
			<div class="form-wrap">
				<h3>——请选择服务人员——</h3>
				<div class="team-list">
					 @foreach($workers as $worker)
					<label class="form-item">
						<span>{{$worker->truename}}</span>
						<input type="radio" value="{{$worker->id}}" name="worker_id" />
					</label>
					@endforeach
					
				</div>
				<div class="tijiao-btn">
					<h4 data-id="{{$data->id}}" id="btnSave" style="cursor:pointer" >确定</h4>
					<h4 id="quxiao">取消</h4>
				</div>
			</div>
		</div>

		@if($worker)
		<div class="popup_bg_2">
			
			<div class="form-wrap2">
				<form action="{{url('user/dashboard/complete')}}?dashboard_id={{$data->id}}" method="post" enctype="multipart/form-data" id="completeForm">
				<h3>反馈信息</h3>
				<div class="line-3"></div>
				
				<div class="input-item2" style="margin-top: 10px;padding: 10px;">
					
					<textarea name="repair_contents" rows="" cols="" placeholder="请进行描述备注">{{$data->repair_contents}}</textarea>
				</div>

				<div class="img-btn btnSubmit" data-type="1">提交反馈</div>
				<div class="img-btn btnSubmit" data-type="100">完工</div>
				<div class="tijiao-btn">
				<h4 id="quxiao2">取消</h4>
			</div>
				{{csrf_field()}}
				<input type="hidden" name="type" id="type" value="1"/>
				</form>
			</div>
		
		</div>
		<!-- 弹出层 end -->

				
				
			
			
			@endif


		<!-- 弹出框 end -->
		<script src="{{asset('user/js/popup.js')}}" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			var accept_num = 0;
			

			
			$("#btnComplete").click(function(){
				$(".mask").show();
				$(".popup_bg_2").show();
			})
			
			$(".img-btn").click(function(){
				$(".mask").hide();
				$(".popup_bg_2").hide();
			})

			$("#quxiao2").click(function(){
				$(".mask").hide();
				$(".popup_bg_2").hide();
			})
		
			$(".img-wrapper img").click(function(){
				$(this).siblings().click()
			})

			$('.btnSubmit').on('click',function(){
				var type = $(this).data('type');
        		$('#type').val(type);
				$('#completeForm').submit();
				$(this).attr('disabled','true');
				$(this).text('提交中...')
			})


			var click_num=0
			$('#btnSave').on('click',function(){
				if(click_num==1) return false;
				
				var _worker_id = $('input[name="worker_id"]:checked').val();
				if(!_worker_id) {
					alert("请选择服务人员");
					return false;
				}
				var _url = "{{url('user/dashboard/process')}}?worker_id="+_worker_id+'&dashboard_id={{$data->id}}';
				window.location.href=_url;
				$(this).html('派单中...')
				click_num=1;
			});
		</script>
	</body>
</html>
